//业务层
let infoDao=require("../Dao/infoDao.js");
let resultUtil=require("../util/ResultUtil.js");

//返回符合条件的数据
async function infoList(filter,page=1,limit=10){
    let data=await infoDao.getInfo(filter,page,limit);
    let count=await infoDao.Count(filter);
    let result= resultUtil(data,count);
   return result;
}

//添加
async function addInfo(info){
    let data=infoDao.addInfo(info);
    return data;
}


//删除
async  function deleteInfo(id){
    let data=await infoDao.deleteInfo(id);
    return data;
}

//修改
async function alterInfo(info){
    let data=await infoDao.alterInfo(info);
    return data;
}


module.exports.infoList=infoList;
module.exports.addInfo=addInfo;
module.exports.deleteInfo=deleteInfo;
module.exports.alterInfo=alterInfo;

